#include "widget.h"
#include "./ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timer = new QTimer(this);

    ui->progressBar->setValue(0);
    connect(timer,&QTimer::timeout,this,[=](){
        updateProgressBar();
    });

    timer->start(1000); // Timer interval set to 1 second
}

Widget::~Widget()
{
    delete ui;
}

void Widget::updateProgressBar()
{
    int value = ui->progressBar->value();
    if (value < 100) {
        value += 10;
        ui->progressBar->setValue(value);
    } else {
        timer->stop();
    }
}
